#pragma once

Context get_ctx(SshWindow wnd);
void fatalbox(SshWindow wnd, char *fmt, ...);
void sys_cursor(SshWindow wnd, int x, int y);
static void sys_cursor_update(SshWindow wnd);
void free_ctx(SshWindow wnd, Context ctx);
void set_raw_mouse_mode(SshWindow wnd, int activate);
void set_sbar(SshWindow wnd, int total, int start, int page);
void term_invalidate(Terminal *term);
void request_resize(SshWindow wnd, int w, int h);
void set_title(SshWindow wnd, char *title);
void set_icon(SshWindow wnd, char *title);
void do_beep(SshWindow wnd, int mode);
void set_iconic(SshWindow wnd, int iconic);
void move_window(SshWindow wnd, int x, int y);
void set_zorder(SshWindow wnd, int top);
void refresh_window(SshWindow wnd);
void set_zoomed(SshWindow wnd, int zoomed);
int is_iconic(SshWindow wnd);
void get_window_pos(SshWindow wnd, int *x, int *y);
void get_window_pixels(SshWindow wnd, int *x, int *y);
char *get_window_title(SshWindow wnd, int icon);
void palette_reset(SshWindow wnd);
int char_width(SshWindow wnd, Context ctx, int uc);
void do_text(SshWindow wnd, Context ctx, int x, int y, wchar_t *text, int len,
	     unsigned long attr, int lattr);
void do_cursor(SshWindow wnd, Context ctx, int x, int y, wchar_t *text, int len,
	       unsigned long attr, int lattr);
void palette_set(SshWindow wnd, int n, int r, int g, int b);
void write_clip(SshWindow wnd, wchar_t * data, int *attr, int len, int must_deselect);
void get_clip(SshWindow wnd, wchar_t ** p, int *len);
void request_paste(SshWindow wnd);

static Mouse_Button translate_button(SshWindow wnd, Mouse_Button button);
static int TranslateKey(SshWindow wnd, UINT message, WPARAM wParam, LPARAM lParam,
			unsigned char *output);
static void cfgtopalette(SshWindow);
static void systopalette(SshWindow);
static void init_palette(SshWindow);
static void init_fonts(SshWindow, int, int);
static void another_font(SshWindow, int);
static void deinit_fonts(SshWindow);
static void set_input_locale(SshWindow, HKL);
static void init_flashwindow(void);
static void flash_window(SshWindow wnd, int mode);
static int is_shift_pressed(void);
static int get_fullscreen_rect(SshWindow wnd, RECT * ss);

static int is_full_screen(SshWindow);
static void make_full_screen(SshWindow);
static void clear_full_screen(SshWindow);
static void flip_full_screen(SshWindow);

/* Window layout information */
static void reset_window(SshWindow, int);
static int get_fullscreen_rect(SshWindow wnd, RECT * ss);
